<?php

/**
 * This file is part of the Framework03 PHP framework.
 * @author Walter Tamboer
 * @package Framework03
 */
 
class FW_View_Helper_HeadLink extends FW_View_Helper_Abstract
{
	private $styleSheets = array();
	
	public function headLink()
    {
		return $this;
    }
	
	public function appendStyleSheet($path, $media = null)
    {
		$this->styleSheets[] = array(
			'path' => $path, 
			'media' => $media
		);
		
		return $this;
    }
	
	public function __toString()
	{
		$src = '';
		foreach ($this->styleSheets as $style)
		{
			$src .= '<link href="' . $style['path'] . '" type="text/css" rel="stylesheet"';
			
			if (isset($style['media']))
			{
				$src .= ' media="' . $style['media'] . '"';
			}
			
			$src .= ' />' . "\n";
		}
		return $src;
	}
}
